<!--
 * @Author: hucc
 * @Date: 2021-09-29 09:25:31
 * @LastEditors: hucc
 * @LastEditTime: 2021-10-06 16:09:05
 * @Description: 
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./jquery.js"></script>
    <script>
        //页面加载完毕执行js代码
        window.onload = function() {
            const promise = new Promise(function(resolve, reject) {
                const baseURL = "http://47.94.46.113:8888"
                $.ajax({
                    url: baseURL + "/index/category/findAll",
                    method: 'get',
                    success(res) {
                        //异步请求成功 调用resolve()
                        resolve(res);
                    },
                    error(res) {
                        //异步请求失败 调用reject()
                        reject(res)
                    }
                })
            })
            promise.then((res) => {
                console.log(res);
            }).catch((err) => {
                console.log(err);
            })
        }
    </script>
</head>

<body>

</body>

</html>